home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / CPP / WFC010.ZIP / INCLUDE / CEVNTLOG.HPP < prev    next >
C/C++ Source or Header  |  1995-12-07  |  4KB  |  111 lines

  1. #if ! defined( EVENT_LOG_CLASS )
  2.  
  3. /*
  4. ** Author: Samuel R. Blackburn
  5. ** CI$: 76300,326
  6. ** Internet: sammy@sed.csc.com
  7. **
  8. ** You can use it any way you like as long as you don't try to sell it.
  9. **
  10. ** Any attempt to sell WFC in source code form must have the permission
  11. ** of the original author. You can produce commercial executables with
  12. ** WFC but you can't sell WFC.
  13. **
  14. ** Copyright, 1995, Samuel R. Blackburn
  15. **
  16. ** $Workfile: $
  17. ** $Revision: $
  18. ** $Modtime: $
  19. */
  20.  
  21. #define EVENT_LOG_CLASS
  22.  
  23. class CEventLog : public CObject
  24. {
  25.    DECLARE_DYNAMIC( CEventLog )
  26.  
  27.    protected:
  28.  
  29.       HANDLE m_LogHandle;
  30.       HANDLE m_EventSourceHandle;
  31.  
  32.       DWORD m_ErrorCode;
  33.       DWORD m_NumberOfBytesRead;
  34.       DWORD m_NumberOfBytesInNextRecord;
  35.  
  36.       void m_Initialize( void );
  37.  
  38.    public:
  39.  
  40.       enum EventType
  41.       {
  42.          eventError       = EVENTLOG_ERROR_TYPE,
  43.          eventWarning     = EVENTLOG_WARNING_TYPE,
  44.          eventInformation = EVENTLOG_INFORMATION_TYPE,
  45.          eventSuccess     = EVENTLOG_AUDIT_SUCCESS,
  46.          eventFailure     = EVENTLOG_AUDIT_FAILURE
  47.       };
  48.  
  49.       CEventLog();
  50.       CEventLog( LPCTSTR source_name );
  51.  
  52.       /*
  53.       ** Destructor should be virtual according to MSJ article in Sept 1992
  54.       ** "Do More with Less Code:..."
  55.       */
  56.  
  57.       virtual ~CEventLog();
  58.  
  59.       /*
  60.       ** Data
  61.       */
  62.  
  63.       CString ComputerName;
  64.       CString LogName;
  65.  
  66.       /*
  67.       ** Methods
  68.       */
  69.  
  70.       virtual BOOL  Backup( LPCTSTR name_of_backup_file );
  71.       virtual BOOL  Clear(  LPCTSTR name_of_backup_file );
  72.       virtual BOOL  Close( void );
  73.       virtual BOOL  CreateApplicationLog( LPCTSTR application_name,
  74.                                           LPCTSTR file_containing_message_table_resource,
  75.                                           DWORD   supported_types );
  76.       virtual BOOL  DeleteApplicationLog( LPCTSTR application_name );
  77.       virtual BOOL  DeregisterSource( void );
  78.       virtual DWORD GetErrorCode( void ) const;
  79.       virtual BOOL  GetNumberOfRecords( DWORD& number_of_records );
  80.       virtual BOOL  NotifyChange( HANDLE event_handle, HANDLE log_handle = NULL );
  81.       virtual BOOL  OpenBackup( LPCTSTR name_of_backup_file, LPCTSTR name_of_computer = NULL );
  82.       virtual BOOL  Open( LPCTSTR log_name, LPCTSTR name_of_computer = NULL );
  83.       virtual BOOL  Read( DWORD  record_number, 
  84.                           LPVOID buffer, 
  85.                           DWORD& number_of_bytes_to_read, 
  86.                           DWORD  how_to_read = EVENTLOG_FORWARDS_READ | EVENTLOG_SEQUENTIAL_READ );
  87.       virtual BOOL  RegisterSource( LPCTSTR source_name, LPCTSTR name_of_computer = NULL );
  88.       virtual BOOL  Report( EventType event_type,
  89.                             WORD      category,
  90.                             DWORD     event_id,
  91.                             WORD      number_of_strings        = 0,
  92.                             LPCTSTR * string_array             = NULL,
  93.                             DWORD     number_of_raw_data_bytes = 0,
  94.                             LPVOID    raw_data_buffer          = NULL,
  95.                             PSID      user_sid                 = NULL );
  96.       virtual BOOL  Report( LPCTSTR   log_name, 
  97.                             DWORD     message_string_resource_id,
  98.                             WORD      number_of_strings = 0,
  99.                             LPCTSTR * string_array      = NULL );
  100.       virtual void  ReportError( LPCTSTR string_to_report );
  101.       virtual void  ReportInformation( LPCTSTR string_to_report );
  102.  
  103. #if defined( _DEBUG )
  104.  
  105.       virtual void Dump( CDumpContext& dump_context ) const;
  106.  
  107. #endif // _DEBUG
  108. };
  109.  
  110. #endif // EVENT_LOG_CLASS
  111.